#ifndef UNIT_H
#define UNIT_H

#include <vector>

#include "../draw/DrawObject.h"
#include "GameObject.h"
#include "model/Model.h"

using namespace std;

class Game;
class GameCommand;
struct UnitType;

enum UnitState { MOVING, STOPPED };

class Unit: public ModelObject, public GameObject
{
	Model m;
	UnitType *type;
	
	unsigned health;
	
	vector <lVec2D> path;	// Result of last path-finding computation
	
	UnitState state;
	
	lVec3D unit_position_in(unsigned long &dt);		// Returns position of the unit dt milliseconds from now
	
	Unit(const Unit&);
	Unit& operator=(const Unit&);
	
public:
	Unit(UnitType*, unsigned x, unsigned y);
	virtual ~Unit()	{}
	
	void update(unsigned long);
	void move(const lVec2D &);		// Process UNIT_MOVE
	void stop();					// Process UNIT_STOP
	
	virtual void draw(unsigned long);
	void getBoundingBox(fVec2D& a, fVec2D& b, fVec2D &c, fVec2D &d);
	
	fVec3D getDrawPos()	{	return drawPos;	}
};

#endif
